package com.lion.common.spring.config;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.lion.common.base.utils.InstantAdapter;
import com.lion.common.spring.annotations.BeanHolder;
import org.springframework.context.annotation.Bean;

import java.time.Instant;

/**
 * @author Chris Chan
 * Create On 2025/8/27 下午10:27
 * Use for: 默认的BeanHolder
 * Explain:
 */
@BeanHolder
public class DefaultBeanHolder {
    /**
     * Gson
     *
     * @return Gson
     */
    @Bean
    public Gson defaultGson() {
        return new GsonBuilder()
                // 注册Instant的序列化器和反序列化器
                .registerTypeAdapter(Instant.class, new InstantAdapter())
                .create();
    }
}
